# 计算1+1/2+(1/2)^2+(1/2)^3+...
def calculate_partial_sum(n):
    result = 0
    term = 1
    for _ in range(n):
        result += term
        term /= 2
    return result

n = 10  # 例如，计算前10项的部分和
print(calculate_partial_sum(n))
